package com.jwl.idc.utils;

import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;

import com.jwl.idc.R;

/**
 * Created by liangfan on 2016/1/7.
 */
public class StringUtils {
    public static boolean checkPhoneNumber(String phoneNumber, Context context) {
        boolean b = false;
        if (TextUtils.isEmpty(phoneNumber) || null == phoneNumber) {
            //输入的号码不能为空
            Toast.makeText(context, context.getString(R.string.phone_number_not_null), Toast.LENGTH_SHORT).show();
        } else if (phoneNumber.length() != 11) {
            Toast.makeText(context, context.getString(R.string.phone_number_has_wrong), Toast.LENGTH_SHORT).show();
        } else
            b = true;
        return b;
    }

    public static boolean checkPwd(String pwd, Context context) {
        boolean b = false;
        if (TextUtils.isEmpty(pwd) || null == pwd) {
            Toast.makeText(context, context.getString(R.string.pwd_input_not_null), Toast.LENGTH_SHORT).show();
        } else if (pwd.length() < 6) {
            Toast.makeText(context, context.getString(R.string.pwd_input_length_error), Toast.LENGTH_SHORT).show();
        } else
            b = true;
        return b;
    }

    public static boolean checkNickName(String nikeName, Context context) {
        boolean b = false;
        if (TextUtils.isEmpty(nikeName) || null == nikeName) {
            //输入的号码不能为空
            Toast.makeText(context, context.getString(R.string.nick_name_not_null), Toast.LENGTH_SHORT).show();
        } else
            b = true;
        return b;
    }

    public static boolean checkYzm(String yzm,Context context){
        boolean b = false;
        if (TextUtils.isEmpty(yzm) || null == yzm) {
            //输入的号码不能为空
            Toast.makeText(context, context.getString(R.string.verificat_code_not_null), Toast.LENGTH_SHORT).show();
        } else
            b = true;
        return b;
    }
}
